﻿CREATE TABLE [dbo].[Task]
(
	[TaskId] UNIQUEIDENTIFIER NOT NULL DEFAULT newid(), 
	[TargetEntity] VARCHAR(128) NOT NULL,
	[TargetId] SQL_VARIANT NOT NULL,
    [DueDate] DATE NOT NULL,
	[Action] NVARCHAR(MAX) NOT NULL,
	[Completed] BIT NOT NULL DEFAULT 0,
	[CompletedDate] DATETIME NULL,
	[DateCreated]  DATETIME         DEFAULT (getdate()) NOT NULL,
    [CreatedBy]    VARCHAR (50)     DEFAULT (suser_sname()) NOT NULL,
    [DateModified] DATE             NULL,
    [ModifiedBy]   VARCHAR (50)     NULL,
    CONSTRAINT [TaskId] PRIMARY KEY NONCLUSTERED ([TaskId] ASC)
)

GO

CREATE CLUSTERED INDEX [IX_PaymentCycle_DueDate] ON [dbo].[Task] ([DueDate])
